/* This part of the code is based on the code given at the following URL:
http://learningandroid.org/index.php?q=tutorial/2009/02/writing-sax-based-rss-and-podcast-parser#*/

package com.android.stockme.backend.fetcher;





public class NewsItem implements INewsItem , Comparable<INewsItem>
{
	
	private String symbol;
	private String pubDate;
	private String title;
	private String link;


		

	public NewsItem(String symbol, String pubDate, String title, String link) {

		this.symbol = symbol;
		this.pubDate = pubDate;
		this.title = title;
		this.link = link;
	}


	public NewsItem() {
		this.symbol = null;
		this.pubDate = null;
		this.title = null;
		this.link = null;
	}


	public String getSymbol()
	{
		
		return this.symbol;
		
	}//getSymbol
	
	
	public void setSymbol(String symbol)
	{
		
		this.symbol = symbol;
		
	}//getSymbol
		
		

	public String getPublishDate()
	{
		return this.pubDate;
	}//getPublishDate
		
	
	
	public void setPublishDate(String pubdate) 
	{
		this.pubDate = pubdate;
		
	}//setPublishDate
	
	

	public String getTitle() 
	{
		
		return this.title;
		
	}//getTitle
			


	public void setTitle(String title) 
	{
		
		this.title = title;
		
	}//setTitle
		
			
	
	public String getLink() 
	{
		return this.link;
	}//getLink


	

	
	public void setLink(String link) 
	{
		
		this.link = link;
		
	}//setLink




	// Sort backwards
	public int compareTo(INewsItem another) {
		if (this.pubDate.compareTo(another.getPublishDate()) != 0)
			return this.pubDate.compareTo(another.getPublishDate());
		
		if (this.pubDate.compareTo(another.getSymbol()) != 0)
			return this.pubDate.compareTo(another.getSymbol());
		
		if (this.pubDate.compareTo(another.getTitle()) != 0)
			return this.pubDate.compareTo(another.getTitle());
	
		return this.pubDate.compareTo(another.getLink());
	}

	
	@Override
	public INewsItem clone() throws CloneNotSupportedException {
		return new NewsItem(this.symbol, this.pubDate, this.title, this.link);
	}


}
